package com.example.forum.service.impl;


import com.example.forum.service.IAsyncTaskService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class AsyncTaskServiceImpl implements IAsyncTaskService {

    @Async
    public void executeAsyncTask1(int i) {
        System.out.println("线程" + Thread.currentThread().getName() + " 执行异步任务：" + i);
    }

    @Async
    public void executeAsyncTask2(int i) {
        System.out.println("线程2" + Thread.currentThread().getName() + " 执行异步任务：" + i);
    }
}
